package br.com.winesys.geta.report;

import java.awt.Window;
import java.util.List;
import br.com.winesys.geta.dialog.ObjectActionDialog;

public abstract class ReportFilter<Filter> extends ObjectActionDialog<Filter> {

	public ReportFilter(Window parent, String title) {
		super(parent, title);
	}

	@Override
	protected boolean execute(Filter filter) {
		List<?> objects = ReportFilter.this.list(filter);
		if (objects.size() > 0) {
			this.doGenerate(filter, objects);
		} else {
			showMessage("A busca não retornou resultados", "Busca");
		}
		return false;
	}

	protected abstract List<?> list(Filter filter);

	protected abstract void doGenerate(Filter filter, List<?> objects);
}
